/**
 * All Rights Reserved , Copyright (C) 2020 , 青岛鼎信通讯股份有限公司
 * BaseRemindTaskController
 * 提醒任务
 * 修改纪录
 * 2020-12-01 版本：1.0 zhanglongfei 创建。
 * 
 * @version 版本：1.0
 * @author 作者：zhanglongfei
 * 创建日期：2020-12-01
 */
package com.topscomm.base.controller;

import java.util.Map;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.topscomm.base.controller.auto.BaseRemindTaskControllerAuto;
import com.topscomm.pub.util.StringBufferProxy;
import com.topscomm.pub.util.StringUtil;
import com.topscomm.pub.vo.ResponseResult;

/**
 * @author: zhanglongfei
 * @date: 2020-12-01
 * @description:提醒任务Controller
 * @modify:
 */
@RestController
@RequestMapping("base/remindTask")
public class BaseRemindTaskController extends BaseRemindTaskControllerAuto implements IBaseRemindTaskController {
	/**
	 * @author: zhanglongfei
	 * @date: 2020-12-01
	 * @param paraMap
	 * @return
	 * @description:转换出查询SQL语句
	 * @modify:
	 */
	@Override
	protected String spellListSql(Map<String, Object> paraMap) {
		StringBufferProxy sql = new StringBufferProxy();
		sql.appendSingle(" 1=1 ");
		if (paraMap.containsKey("qry_name")) {
			String value = paraMap.get("qry_name").toString();
			if (!StringUtil.isEmpty(value))
				sql.appendSingle(" and name like '%{0}%' ", value);
		}
		if (paraMap.containsKey("qry_code")) {
			String value = paraMap.get("qry_code").toString();
			if (!StringUtil.isEmpty(value))
				sql.appendSingle(" and code = '{0}' ", value);
		}
		return sql.toString();
	}

	/**
	 * @author: zhanglongfei
	 * @date: 2020-12-01
	 * @param paraMap
	 * @return
	 * @description:转换出查询SQL语句
	 * @modify:
	 */
	@Override
	@GetMapping(value = "/refList")
	public ResponseResult<Object> refList(@RequestParam(required = false) Map<String, Object> paraMap) {
		return super.refList(paraMap);
	}

	/**
	 * @description: 消息提醒测试接口
	 * @return
	 * @author: maxiaodong
	 * @date: 2021年7月2日上午10:17:30
	 * @modify:
	 */
	@GetMapping(value = "/testMessage")
	public ResponseResult<Object> testMessage() {
		this.service.sendRemindMessage(null);
		return ResponseResult.ok("success_send_message");
	}
}
